package net.lovesrc.allin.jobs;

import net.lovesrc.allin.biz.jobtask.JobTaskService;
import net.lovesrc.allin.jobs.base.BaseJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
//@Profile(value = {"live", "geliclive"})
public class JobTaskProcessJob extends BaseJob {


    private List<JobTaskService> jobTaskServiceList;

    public JobTaskProcessJob(List<JobTaskService> jobTaskServiceList) {
        this.jobTaskServiceList = jobTaskServiceList;
    }

    @Override
    public void runOnce() {
        for (JobTaskService jobTaskService : jobTaskServiceList) {
            if (jobTaskService.isrun()){
                jobTaskService.process();
            }
        }
    }
}
